<!DOCTYPE html>
<html lang="zh-cn">
<head>

<include file="share:meta"/>
<script type="text/javascript">
        
        function jsApiCall()
        {
            // alert('<?php echo $jsApiParameters; ?>');
            WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                {$jsApiParameters},
                function(res){
                    // WeixinJSBridge.log(res.err_msg);
                    // alert(res.err_code+res.err_desc+res.err_msg);
                        switch(res.err_msg) {
                                case 'get_brand_wcpay_request:cancel':
                                        // alert('用户取消支付！');
                                        window.location.href="/pay/orderpayfailure/orderno/{$info.order_no}";
                                        break;
                                case 'get_brand_wcpay_request:fail':
                                        // alert('支付失败！（'+res.err_desc+'）');
                                        window.location.href="/pay/orderpayfailure/orderno/{$info.order_no}";
                                        break;
                                case 'get_brand_wcpay_request:ok':
                                        // alert('支付成功！');
                                        window.location.href="/pay/orderpaysuccess";
                                        break;
                                default:
                                        // alert(JSON.stringify(res));
                                        window.location.href="/pay/orderpayfailure/orderno/{$info.order_no}";
                                        break;
                        }
                }
            );
        }

        function callpay()
        {
            if (typeof WeixinJSBridge == "undefined"){
                    if( document.addEventListener ){
                            document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                    }else if (document.attachEvent){
                            document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
                            document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                    }
            }else{
                    jsApiCall();
            }

        }

        jsApiCall();
        // $(function(){
        //   alert('{$jsApiParameters}');
        // });
        
</script>
</head>
<body>

<div>正在转跳，请稍候...</div>
</body>
</html>
